package com.company.cloud.acct.modules.app.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.company.cloud.acct.modules.cache.models.AcctBillMonthStatModel;
import com.company.cloud.acct.modules.cache.models.AcctCashMonthStatModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AcctAppMapper {

    @Select("select type as type ,DATE_FORMAT(cdt,'%Y-%m') as month, sum(fund_op) as total_fund_op, " +
            "sum(fund_tax) as total_fund_tax, sum(fund_real) as total_fund_real " +
            "from acct_account_bill_info " +
            "${ew.customSqlSegment}")
    public List<AcctBillMonthStatModel> queryAcctBillStatMonth(@Param(Constants.WRAPPER) Wrapper<AcctBillMonthStatModel> wrapper);

    @Select("select DATE_FORMAT(cdt,'%Y-%m') as month, sum(fund) as total_fund, sum(fund_real) as total_fund_real, " +
            "sum(tax_fee) as total_tax_fee, sum(service_fee) as total_service_fee " +
            "from acct_account_cash_info " +
            "${ew.customSqlSegment}")
    public List<AcctCashMonthStatModel> queryAcctCashStatMonth(@Param(Constants.WRAPPER) Wrapper<AcctCashMonthStatModel> wrapper);

}
